package org.jackysoft.controller;

import java.util.Collection;

import javax.annotation.Resource;

import org.jackysoft.controller.base.AbstractController;
import org.jackysoft.entity.OsTask;
import org.jackysoft.service.OsTaskService;
import org.jackysoft.util.Page;
import org.jackysoft.util.WorkflowDataType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

/*******************************************************************************
 * 根据用户需求查找相关的工作流 将结果返回给成功页面
 * 
 * @author SERVER56
 * 
 */

@Controller
@RequestMapping("/oswf/task")
public class OsTaskController extends AbstractController<OsTask> {
	
	
	@Resource
	private OsTaskService service;


	
	@RequestMapping("/mytasks")
	public String execute(@ModelAttribute Page pager,WorkflowDataType dataType,int page,int rows) throws Exception {

		pager = service.getWorkItems(dataType, page, rows);
		return  dataType.name();
	}

	@RequestMapping("/watcher")
	public void watch(long refid,@ModelAttribute  Collection<OsTask> beans) throws Exception {
		beans = service.watchWorkItems(refid);
		
	}
}
